<%@ taglib uri="/WEB-INF/myfaces_html.tld" 	prefix="h" %>
<%@ taglib uri="/WEB-INF/myfaces_core.tld" 	prefix="f" %>
<%@ taglib uri="/WEB-INF/tomahawk.tld"     	prefix="t" %>
<%@ taglib uri="/WEB-INF/myfaces_sandbox.tld"   prefix="s" %>
<%@ page import="java.util.ArrayList" %>

<f:view>
    <jsp:include page="/intestazione.jsp">
        <jsp:param name="titolo" value="Gestione Prima Nota"/>
    </jsp:include>
    <jsp:include page="/menu.jsp"/>
    <script language="javascript" src="./script/popup_full_center.js"></script>
    <script language="javascript" src="./script/ripristinoSessione.js"></script>
    <h:form binding="#{dettaglioPrimaNota.form}">         
        <table class="find" style="border: 2pt solid white; margin-bottom: 5px">
            <hr />
            <tr>  
                <td class="intestazionePagina" align="center">
                <strong> PRIMA NOTA </strong></td>                        
            </tr>        
        </table>
    
        <table class="dettaglio">
            <tbody>     
                <tr>     
                    <td>
                        <h:commandLink styleClass="commandLink_Style" dir="RTL" action="benvenuto" immediate="true">
                            <t:graphicImage url="/image/go-home.png" border="0"/>
                        </h:commandLink>              
                    </td>   
                </tr>
                <tr>
                    <td class="etichettaDettaglio"><strong><t:outputLabel for="dataDa" value="Da data:"/></strong></td>
                    <td><h:outputText value=" (gg/mm/aaaa)" style="font-size:6.5pt"/>
                        <br/>
                        <t:inputCalendar id="dataDa" renderAsPopup="true" renderPopupButtonAsImage="true" popupDateFormat="dd/MM/yyyy" size="10" maxlength="10" styleClass="campoTesto" value="#{beanPrimaNota.dataDa}" required="true">
                            <s:convertDateTime type="date" pattern="dd/MM/yyyy"/>
                        </t:inputCalendar>
                        <br/>
                        <h:message style="color: red; font-size: 8pt" for="dataDa" showDetail="true" showSummary="false" />
                    </td>
                </tr>
                <tr>
                    <td class="etichettaDettaglio"><strong><t:outputLabel for="dataA" value="A data:"/></strong></td>
                    <td><h:outputText value=" (gg/mm/aaaa)" style="font-size:6.5pt"/>
                        <br/>
                        <t:inputCalendar id="dataA" renderAsPopup="true" renderPopupButtonAsImage="true" popupDateFormat="dd/MM/yyyy" size="10" maxlength="10" styleClass="campoTesto" value="#{beanPrimaNota.dataA}" required="true">
                            <s:convertDateTime type="date" pattern="dd/MM/yyyy"/>
                            <s:validateCompareTo operator="ge" for="dataDa" message="La prima data deve essere maggiore della seconda." />
                        </t:inputCalendar>
                        <br/>
                        <h:message style="color: red; font-size: 8pt" for="dataA" showDetail="true" showSummary="false" />
                    </td>
                    <td>
                        <t:commandButton value="Esegui" action="#{dettaglioPrimaNota.calcolaNuovoPeriodoPrimaNota}"/>                                
                    </td>     
                </tr>
            </tbody>
        </table>
        <br />

        <%--
        <table>
        <tr>
        <td width="318px"></td>
        <td bgcolor="#FFF06F" style="border: groove"><em><strong>_______CASSA______</strong></em></td>
        <td bgcolor="#FFF06F" style="border: groove"><em><strong>_______BANCA______</strong></em></td>
        <td bgcolor="#FFF06F" style="border: groove"><em><strong>_______VARIE______</strong></em></td>
        </tr>
        </table>
        --%>
        <t:panelTab id="tabPrimaNota" label="Prima Nota">                
            <f:verbatim><div  style="width:790px; height: 400px; white-space: nowrap; wrap: off"></f:verbatim>
            <t:dataTable id="listaPrimaNota" var="lista" value="#{beanPrimaNota.listaPrimaNota}" preserveDataModel="true"           
                styleClass="dataTableGestisci_Table2" 
                headerClass="dataTableGestisci_Header"
                rowClasses="dataTableGestisci_Row1, dataTableGestisci_Row2"          
                columnClasses="dataTableGestisci_Column" 
                rowOnMouseOver="this.style.backgroundColor='#FFF06F'"
                rowOnMouseOut="this.style.backgroundColor=''">  
                
                <t:column width="3%">                        
                    <f:facet name="header">
                        <t:outputText value="Data"/>
                    </f:facet>                        
                    <t:outputText value="#{lista.dataOperazione}">
                        <f:convertDateTime pattern="dd/MM/yyyy" type="both" timeZone="Europe/Rome"/>
                    </t:outputText>              
                </t:column>    
                
                <t:column width="11%">                        
                    <f:facet name="header">
                        <t:outputText value="Operazione"/>
                    </f:facet>                        
                    <t:outputText value="Totale"            rendered="#{lista.tipo eq 'T'}"/>
                    <t:outputText value="Fattura Acquisto"    rendered="#{lista.tipo eq 'A'}"/>
                    <t:outputText value="Fattura Vendita"     rendered="#{lista.tipo eq 'F'}"/>        
                    <t:outputText value="Inserimento Manuale"      rendered="#{lista.tipo eq 'M'}"/>        
                    <t:outputText value="Scontrino"         rendered="#{lista.tipo eq 'S'}"/>        
                </t:column>       
                
                <t:column width="38%">
                    <f:facet name="header"  >
                        <t:outputText value="Descrizione Operazione" />
                    </f:facet>
                    <t:outputText value="#{lista.descrizione}"/> 
                </t:column>                     
                    
                <t:column width="8%" style="text-align: right; background: #C1E0C0;">
                    <f:facet name="header">
                        <t:outputText value="Entrate cassa"/>
                    </f:facet>
                    <t:outputText value="#{lista.entCasse}"> 
                        <s:convertNumber minIntegerDigits="1" maxFractionDigits="2" pattern="#,##0.00" />
                    </t:outputText> 
                </t:column>      
                    
                <t:column width="8%" style="text-align: right; background: #F06150;">
                    <f:facet name="header"  >
                        <t:outputText value="Uscite Cassa" />
                    </f:facet>
                    <t:outputText value="#{lista.uscCasse}"> 
                        <s:convertNumber minIntegerDigits="1" maxFractionDigits="2" pattern="#,##0.00" />
                    </t:outputText>
                </t:column>      
                    
                <t:column width="8%" style="text-align: right; background: #C1E0C0;">
                    <f:facet name="header"  >
                        <t:outputText value="Versam. Banca" />
                    </f:facet>
                    <t:outputText value="#{lista.entBanca}"> 
                        <s:convertNumber minIntegerDigits="1" maxFractionDigits="2" pattern="#,##0.00" />
                    </t:outputText>
                </t:column>      
                    
                <t:column width="8%" style="text-align: right; background: #F06150;">
                    <f:facet name="header"  >
                        <t:outputText value="Prelievi Banca" />
                    </f:facet>
                    <t:outputText value="#{lista.uscBanca}"> 
                        <s:convertNumber minIntegerDigits="1" maxFractionDigits="2" pattern="#,##0.00" />
                    </t:outputText>
                </t:column>                          
                
                <t:column width="8%" style="text-align: right; background: #C1E0C0;">
                    <f:facet name="header"  >
                        <t:outputText value="Entrate Varie" />
                    </f:facet>
                    <t:outputText value="#{lista.entVarie}"> 
                        <s:convertNumber minIntegerDigits="1" maxFractionDigits="2" pattern="#,##0.00" />
                    </t:outputText>
                </t:column>      
                    
                <t:column width="8%" style="text-align: right; background: #F06150;">
                    <f:facet name="header"  >
                        <t:outputText value="Uscite Varie" />
                    </f:facet>
                    <t:outputText value="#{lista.uscVarie}"> 
                        <s:convertNumber minIntegerDigits="1" maxFractionDigits="2" pattern="#,##0.00" />
                    </t:outputText>
                </t:column>      
                   
            </t:dataTable>  
            <f:verbatim></div></f:verbatim>          
        </t:panelTab>            
    
    </h:form> 
    
    <h:form id="erroriDataBase" rendered="false">
        <f:verbatim><table><td align="left" class="messaggiErrore" height="2px"></f:verbatim>           
        <h:messages style="color: red" showDetail="true" showSummary="false"/>
        <f:verbatim></td></table></f:verbatim>
    </h:form>  
    
    <jsp:include page="/piePagina.jsp"/>      
</f:view>
